package com.meilai.project.controller.web.report.entity;

import com.meilai.project.util.DateRange;
import com.meilai.project.util.DateRangeUtil;
import lombok.Data;

import java.time.LocalDate;

/**
 * @author xchen
 * @since 2022-04-12
 */
@Data
public class WeekReportOccupy {
	private Integer media_id;
	private Integer daterange_id;
	private LocalDate start_at;
	private LocalDate end_at;
	private Integer building_area_id;
	private Integer floor;
	private Long customer_id;
	private String customer_name;
	private Integer flow_status;

	public boolean inRange(DateRange dateRange) {
		return DateRangeUtil.isOverlap(start_at, end_at, dateRange.getBeginDate(), dateRange.getEndDate());
	}

	public String weekSummaryGroupKey() {
		return building_area_id + "-" + floor;
	}

	public String customerGroupKey(){
		return customer_id + "-" + flow_status;
	}

}
